package com.kuding.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kuding.oss.OssComponent;
import com.kuding.props.AliYunOssProperty;

@Configuration
@ConditionalOnProperty(name = "vinus.enable-aliyun-oss", havingValue = "true")
@EnableConfigurationProperties({ AliYunOssProperty.class })
public class AliyunOSSComponentConfig {

	@Autowired
	private AliYunOssProperty aliYunOssProperty;

	@Bean
	public OssComponent ossComponent() {
		OssComponent ossComponent = new OssComponent(aliYunOssProperty);
		return ossComponent;
	}
}
